Imports Microsoft.VisualBasic
Imports System.Xml
Imports System.Collections
Imports DGZfP.EventPublisher
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports DotNetNuke.Security



Namespace DGZfP.EventPublisher

    Public Class SqlSource
        Inherits SourceProvider

        Protected Overloads Overrides Function GetDataTable(ByVal ConnectionString As String, ByVal SqlQuery As String, ByVal Type As String, ByVal NotUsed1 As String) As System.Data.DataTable
            Dim table As New DataTable
            If Type = "Sql" Then
                Using con As SqlConnection = New SqlConnection(ConnectionString)
                    Dim com As New SqlCommand(SqlQuery, con)
                    Dim da As SqlDataAdapter = New SqlDataAdapter(com)
                    da.Fill(table)
                End Using
            Else
                Using con As OleDbConnection = New OleDbConnection(ConnectionString)
                    Dim com As New OleDbCommand(SqlQuery, con)
                    Dim da As OleDbDataAdapter = New OleDbDataAdapter(com)
                    da.Fill(table)
                End Using
            End If
            Return table
        End Function
    End Class
End Namespace